import { createStore } from 'vuex'
import { BaseInfoType } from '@/store/type/baseInfo'
import baseInfo from './modules/baseInfo'
import type { ConfigState } from '@/store/type/config'
import config from './modules/config'
import type { FuncState } from '@/store/type/func'
import func from './modules/func'

type StoreType = {
  baseInfo: BaseInfoType
  config: ConfigState
  func: FuncState
}

const options = {
  actions: {},
  mutations: {},
  modules: {
    baseInfo,
    config,
    func
  }
}

const store = createStore<StoreType>(options)
export default store

export function resetStore () {
  store.replaceState(createStore<StoreType>(options).state)
}
